import request from '@/utils/request'
/**
 * @description: 获取目录列表
 * @param {*} subjectID {学科id}
 * @return {*}
 */
export function DirectorylistAPI ({ page, pagesize, state, directoryName, subjectID }) {
  return request({
    url: '/directorys',
    params: {
      page,
      pagesize,
      state,
      directoryName,
      subjectID
    }
  })
}

/**
 * @description: 目录状态
 * @param {*} id {数据id } state 状态
 * @return {*}
 */

export function stateAPI (id, state) {
  return request({
    method: 'POST',
    url: `/directorys/${id}/${state}`
  })
}

/**
 * @description: 目录详情
 * @param {*} id {数据id }
 * @return {*}
 */

export function detailsApi (id) {
  return request({
    url: `/directorys/${id}`
  })
}
/**
 * @description: 删除
 * @param {*} id {数据id }
 * @return {*}
 */
export function removeAPI ({ id }) {
  return request({
    method: 'DELETE',
    url: `/directorys/${id}`
  })
}

/**
 * @description: 新增
 * @param {*}  subjectID{学科id} , directoryName { 目录名称}
 * @return {*}
 */
export function addedAPI ({ subjectID, directoryName }) {
  return request({
    method: 'POST',
    url: '/directorys',
    data: {
      subjectID,
      directoryName
    }
  })
}

/**
 * @description: 修改数据
 * @param {*}  subjectID{学科id} , directoryName { 目录名称}
 * @return {*}
 */
export function modifyFn ({ id, subjectID, directoryName }) {
  return request({
    method: 'PUT',
    url: `/directorys/${id}`,
    data: {
      id,
      subjectID,
      directoryName
    }
  })
}

/**
 * @description: 目录简单列表
 * @param {*}  subjectID{学科id}
 * @return {*}
 */
export function jiandNAPI () {
  return request({
    url: '/subjects/simple'
  })
}
